package com.handinfo.android.uicontrols;


import android.graphics.Bitmap;
import android.graphics.Color;

import com.handinfo.android.DWGameManager;
import com.handinfo.android.DWGameView;
import com.handinfo.android.core.graphics.DWFont;
import com.handinfo.android.core.graphics.DWGraphics;
import com.handinfo.android.core.object.Actor;
import com.handinfo.android.game.GameActor;
import com.handinfo.android.ui.UIWindows;
import com.handinfo.android.ui.window.UIBag;
import com.handinfo.android.ui.window.UIGetMoney;
import com.handinfo.android.ui.window.UIHook;
import com.handinfo.android.ui.window.UIJiMingTai;
import com.handinfo.android.ui.window.UIMain;
import com.handinfo.android.ui.window.UINeiDanWindow;
import com.handinfo.android.ui.window.UIPet;
import com.handinfo.android.ui.window.UIPetMenu;
import com.handinfo.android.ui.window.UIPrizeWindow;
import com.handinfo.android.ui.window.UIRenWuWindow;
import com.handinfo.android.ui.window.UISetSkillWindow;
import com.handinfo.android.ui.window.UISocial;
import com.handinfo.android.ui.window.UISoulWindow;
import com.handinfo.android.ui.window.UITianGong;
import com.handinfo.android.uicontrols.controls.DWAnimationBox;
import com.handinfo.android.uicontrols.controls.DWControl;
import com.handinfo.android.uicontrols.controls.DWStretchBox;
import com.handinfo.android.uicontrols.controls.DWTabControl;
import com.handinfo.android.utils.Tools;


/**
 * 引导对象
 * @author dingjian
 */
public class DWGuideObject {
	
	public void draw(DWGraphics g, int x, int y, int w, int h) {
		
		if (img_arrows != null) {
			if(m_anim==null){
				m_anim = UIWindows.createAnimation("/anim/xuanzebolang_1.anim");
				switch (m_amin_index) {
				case 1:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_1.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 2:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_2.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 3:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_3.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2-2;
					m_actor.m_posY = y+h/2+5;
					break;
				case 4:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_4.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 5:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_5.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 6:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_6.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 7:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_7.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 8:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_8.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 9:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_9.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 10:
					m_anim = UIWindows.createAnimation("/anim/renwutsdh_1.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 11:
					m_anim = UIWindows.createAnimation("/anim/xuanzebolang_11.anim");
					m_actor = new Actor(m_anim);
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				default:
					break;
				}
				Tools.debugPrintln("指引动画"+m_amin_index);
				Tools.debugPrintln("指引动画X:"+x+"Y:"+y);
				Tools.debugPrintln("指引动画posX:"+m_actor.m_posX+"posY:"+m_actor.m_posY);
			
			}
			if(m_actor!=null){
				
				switch (m_amin_index) {
				case 1:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 2:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 3:
					m_actor.m_posX = x+w/2-2;
					m_actor.m_posY = y+h/2+5;
					break;
				case 4:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 5:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 6:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 7:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 8:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 9:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				case 10:
					m_actor.m_posX = x+w/2;
					m_actor.m_posY = y+h/2;
					break;
				default:
					break;
				}

				g.setClip(0,0,DWGameManager.Screen_Width,DWGameManager.Screen_Height);
				m_actor.nextFrame();
				m_actor.draw(g,0 , 0);
				g.setClip(0,0,DWGameManager.Screen_Width,DWGameManager.Screen_Height);
				
			}
			int sx = 0;
			int sy = 0;
			int offset = 0;
			if (DWControlsManager.getInstance() != null) {
				offset = m_frame_list[(int)(DWControlsManager.getInstance().m_timer % m_frame_list.length)];
			}
			switch (m_direct) {
				case GameActor.DIRECT_N://上

					
					sx = x + w / 2;
					sy = y + h + 5 + offset;
					g.setClip(sx - img_arrows.getWidth() / 2, sy, img_arrows.getWidth(), img_arrows.getHeight());
					g.drawBitmap(img_arrows, sx, sy, Tools.HCENTER_TOP);
					g.drawShadowString(m_font, m_message, Color.BLACK, Color.WHITE, sx, sy + img_arrows.getHeight() - 5, Tools.HCENTER_BOTTOM);
	
					
					break;
				case GameActor.DIRECT_S://下
					
					sx = x + w / 2;
					sy = y - 5 - offset;
					g.setClip(sx - img_arrows.getWidth() / 2, sy, img_arrows.getWidth(), -img_arrows.getHeight());
					g.drawBitmap(img_arrows, sx, sy, Tools.HCENTER_BOTTOM);
					g.drawShadowString(m_font, m_message, Color.BLACK, Color.WHITE, sx, sy - img_arrows.getHeight() + 5, Tools.HCENTER_TOP);

					
					break;
				case GameActor.DIRECT_E://右
					
					sx = x - 5 - offset;
					sy = y + h / 2;
					g.setClip(sx, sy - img_arrows.getHeight() / 2, -img_arrows.getWidth(), img_arrows.getHeight());
					g.drawBitmap(img_arrows, sx, sy, Tools.RIGHT_VCENTER);
					g.drawShadowString(m_font, m_message, Color.BLACK, Color.WHITE,
							sx - img_arrows.getWidth() + 10, sy - m_font.getFontHeight() / 2, Tools.LEFT_TOP);

					
					break;
				case GameActor.DIRECT_W://左
					sx = x + w + 5 + offset;
					sy = y + h / 2;
					g.setClip(sx, sy - img_arrows.getHeight() / 2, img_arrows.getWidth(), img_arrows.getHeight());
					g.drawBitmap(img_arrows, sx, sy, Tools.LEFT_VCENTER);
					g.drawShadowString(m_font, m_message, Color.BLACK, Color.WHITE,
							sx + img_arrows.getWidth() - 10, sy - m_font.getFontHeight() / 2, Tools.RIGHT_TOP);
					break;
			}
		}
	}
	public com.handinfo.android.core.object.Animation m_anim;
	private Actor m_actor; 
	private int[] m_frame_list = {0, 10, 20, 30, 30, 20, 10, 0};
	public DWControl setGuide() {
		try {
			if (m_interface == null || m_interface.equals("")) {
				Tools.debugPrintln("错误 : 用于引导界面为空!");
			} else if (m_element == null || m_element.equals("")) {
				Tools.debugPrintln("错误 : 用于引导元素为空!");
			} else {
				setDirect(m_direct);
				if (m_interface.equals(INTERFACE_MAIN)) {/** 主界面 */
					return checkMain(m_element);
				} else if (m_interface.equals(INTERFACE_QUESTACCEPT)) {/** 接受任务界面 */
					return checkQuestaccept(m_element);
				} else if (m_interface.equals(INTERFACE_QUESTFINISH)) {/** 完成任务界面 */
					return checkQuestfinish(m_element);
				} else if (m_interface.equals(INTERFACE_BAG)) {/** 背包界面 */
					return checkBag(m_element);
				} else if (m_interface.equals(INTERFACE_SKILL)) {/** 技能界面 */
					return checkSkill(m_element);
				} else if (m_interface.equals(INTERFACE_TREE)) {/** 摇钱树界面 */
					return checkTree(m_element);
				} else if (m_interface.equals(INTERFACE_HELPER)) {/** 助手界面 */
					
				} else if (m_interface.equals(INTERFACE_FORGE)) {/** 天工坊界面 */
					return checkForge(m_element);
				} else if (m_interface.equals(INTERFACE_TEMPLE)) {/** 祭天界面 */
					return checkTemple(m_element);
				} else if (m_interface.equals(INTERFACE_DRUG)) {/** 炼丹界面 */
					return checkDrug(m_element);
				} else if (m_interface.equals(INTERFACE_PET)) {/** 宠物界面 */
					return checkPet(m_element);
				} else if (m_interface.equals(INTERFACE_FAMILY)) {/** 家族界面 */
					
				} else if (m_interface.equals(INTERFACE_SOCIAL)) {/** 社交界面 */
					return checkSocial(m_element);
				} else if (m_interface.equals(INTERFACE_AUTO)) {/** 挂机界面 */
					return checkAuto(m_element);
				} else if (m_interface.equals(INTERFACE_SOUL)) {/** 炼魂界面 */
					return checkSoul(m_element);
				} else if (m_interface.equals(INTERFACE_AWARD)) {/** 领奖界面 */
					return checkAward(m_element);
				}
			}
		} catch (Exception e) {
			Tools.debugPrintln("用户引导系统出现异常!");
		}
		return null;
	}
	
	public boolean m_waiting = false;//是否等待界面开启
	public int m_wait_time = 0;//等待时间
	
	/** 类型 */
	public byte m_type = 0;
	/** 按钮 */
	public static final byte GUIDE_TYPE_BUTTON = 0;//按钮
	/** 技能 */
	public static final byte GUIDE_TYPE_SKILL = 1;//技能
	/** 格子 */
	public static final byte GUIDE_TYPE_GRID = 2;//格子
	/** 任务 */
	public static final byte GUIDE_TYPE_TASK = 3;//任务
	
	public DWFont m_font = DWFont.getFont(20);
	
	/** 类型为按钮,技能,任务时使用key */
	public String m_key = null;
	
	/** 类型为格子时使用guid */
	public long m_guid = 0;
	
	/** 引导方向 */
	public byte m_direct = 0;
	/**
	 * 设置方向
	 * @param direct
	 */
	public void setDirect(byte direct) {
		switch (direct) {
			case GameActor.DIRECT_N://上
				img_arrows = UIWindows.createImage(IMAGE_PATH + "jiaoxuejt_3" + IMAGE_SUFFIX);
				break;
			case GameActor.DIRECT_S://下
				img_arrows = UIWindows.createImage(IMAGE_PATH + "jiaoxuejt_4" + IMAGE_SUFFIX);
				break;
			case GameActor.DIRECT_W://左
				img_arrows = UIWindows.createImage(IMAGE_PATH + "jiaoxuejt_1" + IMAGE_SUFFIX);
				break;
			case GameActor.DIRECT_E://右
				img_arrows = UIWindows.createImage(IMAGE_PATH + "jiaoxuejt_2" + IMAGE_SUFFIX);
				break;
		}
		m_direct = direct;
	}
	
	/** 引导图片 */
	public Bitmap img_arrows = null;
	
	private final String IMAGE_PATH = "/img/newui/";
	
	private final String IMAGE_SUFFIX = ".gnp";
	
	/** 引导图片名字 */
	public String m_image_name = null;
	/** 引导信息 */
	public String m_message = null;
	/** 引导的原始文本 */
	public String m_content = null;
	
	/** 下次出现的等待时间 */
	public int m_wait_next = 0;
	
	/** 界面 */
	public String m_interface = null;
	/** 元素 */
	public String m_element = null;
	/** 元素动画 */
	public byte m_amin_index = 0;
	
//	/** 上一个引导的控件 */
//	public DWControl m_parent_guide = null;
	
	/** 主界面 */
	public static final String INTERFACE_MAIN = "main";
	/** 接受任务界面 */
	public static final String INTERFACE_QUESTACCEPT = "questaccept";
	/** 完成任务界面 */
	public static final String INTERFACE_QUESTFINISH = "questfinish";
	/** 背包界面 */
	public static final String INTERFACE_BAG = "bag";
	/** 技能界面 */
	public static final String INTERFACE_SKILL = "skill";
	/** 摇钱树界面 */
	public static final String INTERFACE_TREE = "tree";
	/** 助手界面 */
	public static final String INTERFACE_HELPER = "helper";
	/** 天工坊界面 */
	public static final String INTERFACE_FORGE = "forge";
	/** 祭天界面 */
	public static final String INTERFACE_TEMPLE = "temple";
	/** 炼丹界面 */
	public static final String INTERFACE_DRUG = "drug";
	/** 宠物界面 */
	public static final String INTERFACE_PET = "pet";
	/** 家族界面 */
	public static final String INTERFACE_FAMILY = "family";
	/** 社交界面 */
	public static final String INTERFACE_SOCIAL = "social";
	/** 挂机界面 */
	public static final String INTERFACE_AUTO = "auto";
	/** 炼魂界面 */
	public static final String INTERFACE_SOUL = "soul";
	/** 领奖界面 */
	public static final String INTERFACE_AWARD = "award";
	
	//后加
	/** 副本界面 */
	public static final String INTERFACE_INSTANCE = "instance";
	/** 可接任务 */
	public static final String INTERFACE_MAIN_KEJIE = "main_kejie";
	/** 天工坊 镶嵌 */
	public static final String INTERFACE_FORGE_XIANGQIAN = "forge_xiangqian";
	/** 天工坊 强化 */
	public static final String INTERFACE_FORGE_QIANGHUA = "forge_qianghua";
	/** 家族祈福 */
	public static final String INTERFACE_FAMILY_QIFU = "family_qifu";
	/** 排行榜 等级 */
	public static final String INTERFACE_RANKING_DENGJI = "ranking_dengji";
	/** 排行榜 家族 */
	public static final String INTERFACE_RANKING_JIAZU = "ranking_jiazu";
	/** 排行榜 财富 */
	public static final String INTERFACE_RANKING_CAIFU = "ranking_caifu";
	/** 排行榜 击杀 */
	public static final String INTERFACE_RANKING_JISHA = "ranking_jisha";
	/** 排行榜 贡献 */
	public static final String INTERFACE_RANKING_GONGXIAN = "ranking_gongxian";
	/** 排行榜 战功 */
	public static final String INTERFACE_RANKING_ZHANGONG = "ranking_zhangong";
	/** 排行榜 社交 */
	public static final String INTERFACE_RANKING_SHEJIAO = "ranking_shejiao";
	/** 排行榜 个人竞技 */
	public static final String INTERFACE_RANKING_GERENJINGJI = "ranking_gerenjingji";
	/** 排行榜 家族经济 */
	public static final String INTERFACE_RANKING_JIAZUJINGJI = "ranking_jiazujingji";
	/** 排行榜 婚姻 */
	public static final String INTERFACE_RANKING_HUNYIN = "ranking_hunyin";
	
	
	
	//////////////////////////////////////////////////////
	//	主界面
	//////////////////////////////////////////////////////
	/** 头像 */
	public static final String MAIN_HEAD = "head";
	/** 助手 */
	public static final String MAIN_HELPER = "helper";
	/** 信件 */
	public static final String MAIN_LETTER = "letter";
	/** 宠物 */
	public static final String MAIN_PET = "pet";
	/** 地图 */
	public static final String MAIN_MAP = "map";
	/** 任务提示 */
	public static final String MAIN_MINIQUEST = "miniquest";
	/** 战斗技能1 */
	public static final String MAIN_COMBAT_SKILL1 = "skill1";
	/** 战斗技能2 */
	public static final String MAIN_COMBAT_SKILL2 = "skill2";
	/** 战斗技能3 */
	public static final String MAIN_COMBAT_SKILL3 = "skill3";
	/** 挂机 */
	public static final String MAIN_AUTO = "auto";
	/** 聊天 */
	public static final String MAIN_CHAT = "chat";
	/** 功能按钮,齿轮 */
	public static final String MAIN_FUNCTION = "function";
	/** 任务 */
	public static final String MAIN_QUEST = "quest";
	/** 副本	 */
	public static final String MAIN_INSTANCE = "instance";
	/** 摇钱 */
	public static final String MAIN_TREE = "tree";
	/** 天工坊 */
	public static final String MAIN_FORGE = "forge";
	/** 祭天台 */
	public static final String MAIN_TEMPLE = "temple";
	/** 排行榜 */
	public static final String MAIN_RANKING = "ranking";
	/** 炼丹 */
	public static final String MAIN_DRUG = "drug";
	/** 炼魂 */
	public static final String MAIN_SOUL = "soul";
	/** 人物 */
	public static final String MAIN_CHAR = "char";
	/** 背包 */
	public static final String MAIN_BAG = "bag";
	/** 家族 */
	public static final String MAIN_FAMILY = "family";
	/** 技能	 */
	public static final String MAIN_SKILL = "skill";
	/** 社交 */
	public static final String MAIN_SOCIAL = "social";
	/** 设置	 */
	public static final String MAIN_OPTION = "option";
	/** 主界面小任务区 第一个任务 */
	public static final String MAIN_MINIQUEST_1 = "miniquest_1";
	/** 领奖 */
	public static final String MAIN_AWARD = "award";

	
	/**
	 * 检测主界面元素
	 * @param element
	 * @return
	 */
	public DWControl checkMain(String element) {
		UIMain main = UIWindows.getMain();
		if (main != null) {
			DWControl control = null;
			if (element.equals(MAIN_HEAD)) {/** 头像 */
				if (main.m_zhurenwu != null) {
					control = main.m_zhurenwu;
				}
			} else if (element.equals(MAIN_HELPER)) {/** 助手 */
				if (main.m_imageBox_huodong != null) {
					control = main.m_imageBox_huodong;
				}
			} else if (element.equals(MAIN_LETTER)) {/** 信件 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_youjian] != null) {
					control = main.m_MainImageBox[main.m_main_youjian];
				}
			} else if (element.equals(MAIN_PET)) {/** 宠物 */
				if (main.m_iamgeBox_chongwu != null) {
					control = main.m_iamgeBox_chongwu;
				}
			} else if (element.equals(MAIN_MAP)) {/** 地图 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_xiaoditu] != null) {
					control = main.m_MainImageBox[main.m_main_xiaoditu];
				}
			} else if (element.equals(MAIN_MINIQUEST)) {/** 任务提示 */
				if (main.m_task_listBox != null) {
					main.OpenTaskList();
					control = main.m_task_listBox;
				}
			} else if (element.equals(MAIN_COMBAT_SKILL1)) {/** 战斗技能1 */
				if (main.m_grid_dizi != null) {
					control = main.m_grid_dizi[2];
				}
			} else if (element.equals(MAIN_COMBAT_SKILL2)) {/** 战斗技能2 */
				if (main.m_grid_dizi != null) {
					control = main.m_grid_dizi[1];
				}
			} else if (element.equals(MAIN_COMBAT_SKILL3)) {/** 战斗技能3 */
				if (main.m_grid_dizi != null) {
					control = main.m_grid_dizi[0];
				}
			} else if (element.equals(MAIN_AUTO)) {/** 挂机 */
				if (main.m_grid_dizi != null) {
					control = main.m_grid_dizi[5];
				}
			} else if (element.equals(MAIN_CHAT)) {/** 聊天 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_liaotiananniu] != null) {
					control = main.m_MainImageBox[main.m_main_liaotiananniu];
				}
			} else if (element.equals(MAIN_FUNCTION)) {/** 功能按钮,齿轮 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_xiayincang] != null) {
					control = main.m_MainImageBox[main.m_main_xiayincang];
				}
			} else if (element.equals(MAIN_QUEST)) {/** 任务 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_youxirenwu] != null) {
					main.m_main_sb02.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_youxirenwu];
				}
			} else if (element.equals(MAIN_INSTANCE)) {/** 副本	 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_fuben] != null) {
					main.m_main_sb02.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_fuben];
				}
			} else if (element.equals(MAIN_TREE)) {/** 摇钱 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_yaoqianshu] != null) {
					main.m_main_sb02.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_yaoqianshu];
				}
			} else if (element.equals(MAIN_FORGE)) {/** 天工坊 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_gongfang] != null) {
					main.m_main_sb02.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_gongfang];
				}
			} else if (element.equals(MAIN_TEMPLE)) {/** 祭天台 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_jitian] != null) {
					main.m_main_sb02.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_jitian];
				}
			} else if (element.equals(MAIN_RANKING)) {/** 排行榜 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_gonglue] != null) {
					main.m_main_sb02.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_gonglue];
				}
			} else if (element.equals(MAIN_DRUG)) {/** 炼丹 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_liandan] != null) {
					main.m_main_sb02.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_liandan];
				}
			} else if (element.equals(MAIN_SOUL)) {/** 炼魂 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_lianhun] != null) {
					main.m_main_sb02.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_lianhun];
				}
			} else if (element.equals(MAIN_CHAR)) {/** 人物 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_renwu] != null) {
					main.m_main_sb01.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_renwu];
				}
			} else if (element.equals(MAIN_BAG)) {/** 背包 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_beibao] != null) {
					main.m_main_sb01.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_beibao];
				}
			} else if (element.equals(MAIN_FAMILY)) {/** 家族 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_jiazu] != null) {
					main.m_main_sb01.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_jiazu];
				}
			} else if (element.equals(MAIN_SKILL)) {/** 技能 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_jineng] != null) {
					main.m_main_sb01.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_jineng];
				}
			} else if (element.equals(MAIN_SOCIAL)) {/** 社交 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_shejiao] != null) {
					main.m_main_sb01.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_shejiao];
				}
			} else if (element.equals(MAIN_OPTION)) {/** 设置 */
				if (main.m_MainImageBox != null && main.m_MainImageBox[main.m_main_shezhi] != null) {
					main.m_main_sb01.setState(DWStretchBox.TAG_STATE_STRETCH);
					control = main.m_MainImageBox[main.m_main_shezhi];
				}
			} else if (element.equals(MAIN_MINIQUEST_1)) {/** 任务区第一个任务 */
				control = main.getSubItem();
			} else if (element.equals(MAIN_AWARD)) {/** 领奖 */
				control = main.getBanJiangIcon();
			}
			else {
				Tools.debugPrintln("错误 : 用户引导主界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}

	//////////////////////////////////////////////////////
	//	接受任务界面
	//////////////////////////////////////////////////////
	/** 接受 */
	public static final String QUESTACCEPT_ACCEPT = "accept";
	/** 关闭 */
	public static final String QUESTACCEPT_SHUT = "shut";
	
	/**
	 * 检测接受任务界面元素
	 * @param element
	 * @return
	 */
	public DWControl checkQuestaccept(String element) {
		UIRenWuWindow task = UIWindows.getInstance().m_renwu;
		if (task != null) {
			DWControl control = null;
			if (element.equals(QUESTACCEPT_ACCEPT)) {/** 接受 */
				control = task.getNPCButton();
			} else if (element.equals(QUESTACCEPT_SHUT)) {/** 关闭 */
				if (task.m_tc_ima != null) {
					control = task.m_tc_ima;
				}
			} else {
				Tools.debugPrintln("错误 : 用户引导接受任务界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	//////////////////////////////////////////////////////
	//	完成任务界面
	//////////////////////////////////////////////////////
	/** 完成 */
	public static final String QUESTFINISH_FINISH = "finish";
	/** 关闭 */
	public static final String QUESTFINISH_SHUT = "shut";
	
	/**
	 * 检测完成任务界面元素
	 * @param element
	 * @return
	 */
	public DWControl checkQuestfinish(String element) {
		UIRenWuWindow task = UIWindows.getInstance().m_renwu;
		if (task != null) {
			DWControl control = null;
			if (element.equals(QUESTFINISH_FINISH)) {/** 完成 */
				control = task.getNPCButton();
			} else if (element.equals(QUESTFINISH_SHUT)) {/** 关闭 */
				if (task.m_tc_ima != null) {
					control = task.m_tc_ima;
				}
			} else {
				Tools.debugPrintln("错误 : 用户引导完成任务界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	//////////////////////////////////////////////////////
	//	背包界面
	//////////////////////////////////////////////////////
	/** 属性 */
	public static final String BAG_ATT = "att";
	/** 指定道具ID */
	public static final String BAG_KEY = "key_";
	/** 使用道具 */
	public static final String BAG_USEITEM = "useitem";
	/** 装备道具 */
	public static final String BAG_EQUIPITEM = "equipitem";
	/** 关闭 */
	public static final String BAG_SHUT = "shut";
	
	/**
	 * 检测背包界面元素
	 * @param element
	 * @return
	 */
	private DWControl checkBag(String element) {
		UIBag bag = UIWindows.getInstance().m_bag;
		if (bag != null) {
			DWControl control = null;
			if (element.indexOf(BAG_KEY) != -1) {/** 指定道具ID */
				String key = element.substring(element.indexOf(BAG_KEY) + 4);
				control = bag.getGrid(key);
				Tools.debugPrintln("背包引导 查找key : " + key + " : " + control);
			} else if (element.equals(BAG_ATT)) {
				control = bag.m_bag_statsButton;
			} else if (element.equals(BAG_USEITEM)) {
				control = bag.getUser();
			} else if (element.equals(BAG_SHUT)) {
				control = bag.m_bag_closewindow;
			} else if (element.equals(BAG_EQUIPITEM)) {
				control = bag.getEquip();
			}
			else {
				Tools.debugPrintln("错误 : 用户引导背包界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	//////////////////////////////////////////////////////
	//	宠物界面
	//////////////////////////////////////////////////////
	
	/** 指定宠物ID */
	public static final String PET_KEY = "key_";
	/** 出战/收回 */
	public static final String PET_SETPET = "setpet";
	/** 关闭 */
	public static final String PET_SHUT = "shut";

	/**
	 * 检测宠物界面元素
	 * @param element
	 * @return
	 */
	private DWControl checkPet(String element) {
		UIPet pet = UIWindows.getInstance().m_pet;
		if (pet != null) {
			DWControl control = null;
			if (element.indexOf(PET_KEY) != -1) {/** 指定宠物ID */
				String key = element.substring(element.indexOf(PET_KEY) + 4);
				control = pet.getGrid(key);
			} else if (element.equals(PET_SETPET)) {/** 出战/收回 */
				UIPetMenu pm = UIWindows.getInstance().m_petMenu;
				if (pm != null) {
					control = pm.isNewButton();
				}
			} else if (element.equals(PET_SHUT)) {/** 关闭 */
				control = pet.m_pet_close;
			} else {
				Tools.debugPrintln("错误 : 用户引导宠物界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}

	
	//////////////////////////////////////////////////////
	//	摇钱树界面
	//////////////////////////////////////////////////////
	/** 浇水 */
	public static final String TREE_WATER = "water";
	/** 收取 */
	public static final String TREE_GAIN = "gain";
	/** 关闭 */
	public static final String TREE_SHUT = "shut";
	
	/**
	 * 检测摇钱树界面
	 * @param element
	 * @return
	 */
	private DWControl checkTree(String element) {
		UIGetMoney getM = UIWindows.getInstance().m_getMoney;
		if (getM != null) {
			DWControl control = null;
			if (element.equals(TREE_WATER) || element.equals(TREE_GAIN)) {/** 浇水 *//** 收取 */
				control = getM.isNewButton();
			} else if (element.equals(TREE_SHUT)) {/** 关闭 */
				control = getM.isNewImageBox();
			} else {
				Tools.debugPrintln("错误 : 用户引导摇钱树界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	//////////////////////////////////////////////////////
	//	天工坊界面
	//////////////////////////////////////////////////////
		
	/** 熔炼页 */
	public static final String FORGE_RONGLIANPAGE = "ronglianpage";
	/** 熔炼按钮 */
	public static final String FORGE_RONGLIAN = "ronglian";
	/** 强化页 */
	public static final String FORGE_QIANGHUAPAGE = "qianghuapage";
	/** 强化按钮 */
	public static final String FORGE_QIANGHUA = "qianghua";
	/** 取消强化 */
	public static final String FORGE_FANHUAN = "fanhuan";
	/** 镶嵌页 */
	public static final String FORGE_XIANGQIANPAGE = "xiangqianpage";
	/** 力孔位 */
	public static final String FORGE_LIKONG = "likong";
	/** 智孔位 */
	public static final String FORGE_ZHIKONG = "zhikong";
	/** 技孔位 */
	public static final String FORGE_JIKONG = "jikong";
	/** 敏孔位 */
	public static final String FORGE_MINKONG = "minkong";
	/** 镶嵌按钮 */
	public static final String FORGE_XIANGQIAN = "xiangqian";
	/** 取下按钮 */
	public static final String FORGE_QUXIA = "quxia";
	/** 选择道具 熔炼1, 强化2, 镶嵌3, 合成4 */
	public static final String FORGE_KEY1 = "key1_";
	/** 选择道具 熔炼1, 强化2, 镶嵌3, 合成4 */
	public static final String FORGE_KEY2 = "key2_";
	/** 选择道具 熔炼1, 强化2, 镶嵌3, 合成4 */
	public static final String FORGE_KEY3 = "key3_";
	/** 选择道具 熔炼1, 强化2, 镶嵌3, 合成4 */
	public static final String FORGE_KEY4 = "key4_";
	/** 合成页 */
	public static final String FORGE_HECHENGPAGE = "hechengpage";
	/** 合成按钮 */
	public static final String FORGE_HECHENG = "hecheng";
	/** 关闭 */
	public static final String FORGE_SHUT = "shut";
	/** 熔炼第一格 */
	public static final String FORGE_RONGLIAN_1 = "ronglian_1";
	/** 强化第一格 */
	public static final String FORGE_QIANGHUA_1 = "qianghua_1";
	/** 镶嵌第一格 */
	public static final String FORGE_XIANGQIAN_1 = "xiangqian_1";
	/** 灵石第一格 */
	public static final String FORGE_LINGSHI_1 = "lingshi_1";
	
	/**
	 * 检测天工坊界面元素
	 * @param element
	 * @return
	 */
	private DWControl checkForge(String element) {
		UITianGong tg = UIWindows.getInstance().m_tiangong;
		if (tg != null) {
			DWControl control = null;
			if (element.indexOf(FORGE_KEY1) != -1) {/** 选择道具 熔炼1 */
				long id = Long.parseLong(element.substring(element.indexOf(FORGE_KEY1) + 4));
				control = tg.getListSubItem(0, id);
			} else if (element.indexOf(FORGE_KEY2) != -1) {/** 选择道具 强化2 */
				long id = Long.parseLong(element.substring(element.indexOf(FORGE_KEY2) + 4));
				control = tg.getListSubItem(1, id);
			} else if (element.indexOf(FORGE_KEY3) != -1) {/** 选择道具 镶嵌3 */
				long id = Long.parseLong(element.substring(element.indexOf(FORGE_KEY3) + 4));
				control = tg.getListSubItem(2, id);
			} else if (element.indexOf(FORGE_KEY4) != -1) {/** 选择道具 合成4 */
				long id = Long.parseLong(element.substring(element.indexOf(FORGE_KEY4) + 4));
				control = tg.getListSubItem(3, id);
			} else if (element.equals(FORGE_RONGLIANPAGE)) {/** 熔炼页 */
				DWTabControl tc = tg.m_tgTabControl01;
				tc.setGuidePageIndex(0);
				control = tc;
			} else if (element.equals(FORGE_RONGLIAN)) {/** 熔炼按钮 */
				control = tg.m_tgButton01;
			} else if (element.equals(FORGE_QIANGHUAPAGE)) {/** 强化页 */
				DWTabControl tc = tg.m_tgTabControl01;
				tc.setGuidePageIndex(1);
				control = tc;
			} else if (element.equals(FORGE_QIANGHUA)) {/** 强化按钮 */
				control = tg.m_tgButton02;
			} else if (element.equals(FORGE_FANHUAN)) {/** 取消强化 */
				control = tg.m_tgButton03;
			} else if (element.equals(FORGE_XIANGQIANPAGE)) {/** 镶嵌页 */
				DWTabControl tc = tg.m_tgTabControl01;
				tc.setGuidePageIndex(2);
				control = tc;
			} else if (element.equals(FORGE_LIKONG)) {/** 力孔位 */
				control = tg.m_tgGrid05[0];
			} else if (element.equals(FORGE_ZHIKONG)) {/** 智孔位 */
				control = tg.m_tgGrid05[1];
			} else if (element.equals(FORGE_JIKONG)) {/** 技孔位 */
				control = tg.m_tgGrid05[2];
			} else if (element.equals(FORGE_MINKONG)) {/** 敏孔位 */
				control = tg.m_tgGrid05[3];
			} else if (element.equals(FORGE_XIANGQIAN)) {/** 镶嵌按钮 */
				control = tg.m_tgPopMenu01.getButton(0);
			} else if (element.equals(FORGE_QUXIA)) {/** 取下按钮 */
				control = tg.m_tgPopMenu01.getButton(0);
			} else if (element.equals(FORGE_HECHENGPAGE)) {/** 合成页 */
				DWTabControl tc = tg.m_tgTabControl01;
				tc.setGuidePageIndex(3);
				control = tc;
			} else if (element.equals(FORGE_HECHENG)) {/** 合成按钮 */
				control = tg.m_tgButton07;
			} else if (element.equals(FORGE_SHUT)) {/** 关闭 */
				control = tg.m_tgImageBox01;
			} else if (element.equals(FORGE_RONGLIAN_1)) {/** 熔炼第一格 */
				control = tg.ronglian_open();
			} else if (element.equals(FORGE_QIANGHUA_1)) {/** 强化第一格 */
				control = tg.qianghua_open();
				Tools.debugPrintln("得到强化第一格:"+control);
			} else if (element.equals(FORGE_XIANGQIAN_1)) {/** 镶嵌第一格 */
				control = tg.xiangqian_open();
			} else if (element.equals(FORGE_LINGSHI_1)) {/** 灵石第一格 */
				control = tg.hecheng_open();
			} else {
				Tools.debugPrintln("错误 : 用户引导天工坊界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	
	//////////////////////////////////////////////////////
	//	祭天台界面
	//////////////////////////////////////////////////////
	
	/** 神像1 */
	public static final String TEMPLE_SHENXIANG1 = "shenxiang1";
	/** 神像2 */
	public static final String TEMPLE_SHENXIANG2 = "shenxiang2";
	/** 神像3 */
	public static final String TEMPLE_SHENXIANG3 = "shenxiang3";
	/** 神像4 */
	public static final String TEMPLE_SHENXIANG4 = "shenxiang4";
	/** 神像5 */
	public static final String TEMPLE_SHENXIANG5 = "shenxiang5";
	/** 全部收取 */
	public static final String TEMPLE_SHOUQU = "shouqu";
	/** 装备天命 - 祭拜界面 */
	public static final String TEMPLE_ZHUANGBEI = "zhuangbei";
	/** 连续祭拜 */
	public static final String TEMPLE_LIANXU = "lianxu";
	/** 天命背包 */
	public static final String TEMPLE_TIANMING = "tianming_1_1";
	/** 装备天命 - 天命属性界面 */
	public static final String TEMPLE_EQUIP = "equip";
	/** 关闭 */
	public static final String TEMPLE_SHUT = "shut";
	
	/**
	 * 检测祭天台界面元素
	 * @param element
	 * @return
	 */
	private DWControl checkTemple(String element) {
		UIJiMingTai jitian = UIWindows.getInstance().m_jiming;
		if (jitian != null) {
			DWControl control = null;
			if (element.equals(TEMPLE_SHENXIANG1)) {/** 神像1 */
				control = jitian.m_jmtButton03;
			} else if (element.equals(TEMPLE_SHENXIANG2)) {/** 神像2 */
				control = jitian.m_jmtButton04;
			} else if (element.equals(TEMPLE_SHENXIANG3)) {/** 神像3 */
				control = jitian.m_jmtButton05;
			} else if (element.equals(TEMPLE_SHENXIANG4)) {/** 神像4 */
				control = jitian.m_jmtButton06;
			} else if (element.equals(TEMPLE_SHENXIANG5)) {/** 神像5 */
				control = jitian.m_jmtButton07;
			} else if (element.equals(TEMPLE_SHOUQU)) {/** 全部收取 */
				control = jitian.m_jmtButton_jttBT04;
			} else if (element.equals(TEMPLE_ZHUANGBEI)) {/** 装备天命 - 祭拜界面 */
				control = jitian.m_jmtButton_jttBT01;
			} else if (element.equals(TEMPLE_LIANXU)) {/** 连续祭拜 */
				control = jitian.m_jmtButton_jttBT02;
			} else if (element.equals(TEMPLE_TIANMING)) {/** 天命背包 */
				control = jitian.grids_open();
			} else if (element.equals(TEMPLE_EQUIP)) {/** 装备天命 - 天命属性界面 */
				control = jitian.button_open();
			} else if (element.equals(TEMPLE_SHUT)) {/** 关闭 */
				control = jitian.m_jmtImageBox02;
			} else {
				Tools.debugPrintln("错误 : 用户引导祭天台界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}

	//////////////////////////////////////////////////////
	//	挂机界面
	//////////////////////////////////////////////////////
	/** 开始挂机/停止挂机 */
	public static final String AUTO_START = "start";
	/** 关闭 */
	public static final String AUTO_SHUT = "shut";
	
	public DWControl checkAuto(String element) {
		UIHook hook = UIWindows.getInstance().m_hook;
		if (hook != null) {
			DWControl control = null;
			if (element.equals(AUTO_START)) {
				control = hook.hookButton();
			} else if (element.equals(AUTO_SHUT)) {
				control = hook.closeButton();
			} else {
				Tools.debugPrintln("错误 : 用户引导挂机界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	//////////////////////////////////////////////////////
	//	炼丹界面
	//////////////////////////////////////////////////////
	/** 力丹页 */
	public static final String DRUG_LIDANPAGE = "lidanpage";
	/** 智丹页 */
	public static final String DRUG_ZHIDANPAGE = "zhidanpage";
	/** 技丹页 */
	public static final String DRUG_JIDANPAGE = "jidanpage";
	/** 敏丹页 */
	public static final String DRUG_MINDANPAGE = "mindanpage";
	/** 力丹第一排孔 */
	public static final String DRUG_LIDAN_KONG_1 = "lidank";
	/** 智丹第一排孔 */
	public static final String DRUG_ZHIDAN_KONG_1 = "zhidank";
	/** 技丹第一排孔 */
	public static final String DRUG_JIDAN_KONG_1 = "zhidank";
	/** 敏丹第一排孔 */
	public static final String DRUG_MINDAN_KONG_1 = "zhidank";
	
	public DWControl checkDrug(String element) {
		UINeiDanWindow neidan = UIWindows.getInstance().m_neidan;
		if (neidan != null) {
			DWControl control = null;
			if (element.equals(DRUG_LIDANPAGE)) {
				DWTabControl tc = neidan.tabcontrol();
				if (tc != null) {
					tc.setGuidePageIndex(0);
					control = tc;
				}
			} else if (element.equals(DRUG_ZHIDANPAGE)) {
				DWTabControl tc = neidan.tabcontrol();
				if(tc != null)
				{
					tc.setGuidePageIndex(1);
					control = tc;
				}
			} else if (element.equals(DRUG_JIDANPAGE)) {
				DWTabControl tc = neidan.tabcontrol();
				if(tc != null)
				{
					tc.setGuidePageIndex(2);
					control = tc;
				}
			} else if (element.equals(DRUG_MINDANPAGE)) {
				DWTabControl tc = neidan.tabcontrol();
				if(tc != null)
				{
					tc.setGuidePageIndex(3);
					control = tc;
				}
			} else if (element.equals(DRUG_LIDAN_KONG_1)) {
				control = neidan.getLiDanImage();
			} else if (element.equals(DRUG_ZHIDAN_KONG_1)) {
				control = neidan.getZhiDanImage();
			} else if (element.equals(DRUG_JIDAN_KONG_1)) {
				control = neidan.getJiDanImage();
			} else if (element.equals(DRUG_MINDAN_KONG_1)) {
				control = neidan.getMinDanImage();
			} else {
				Tools.debugPrintln("错误 : 用户引导炼丹界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	//////////////////////////////////////////////////////
	//	技能界面
	//////////////////////////////////////////////////////
	/** 技能栏第一格 */
	public static final String SKILL_JINENG_1 = "jineng_1";
	/** 设置技能 */
	public static final String SKILL_SHEZHI = "shezhi";
	/** 装备技能第二格 */
	public static final String SKILL_JINENG_2 = "jineng_2";
	/** 技能栏 升级按钮 */
	public static final String SKILL_JINENGSHENGJI_1 = "jinengshengji_1";
	/** 升级界面 升级按钮 */
	public static final String SKILL_SHENGJI = "shengji";
	/** 关闭 */
	public static final String SKILL_SHUT = "shut";
	
	public DWControl checkSkill(String element) {
		UISetSkillWindow skill = UIWindows.getInstance().m_skill;
		if (skill != null) {
			DWControl control = null;
			if (element.equals(SKILL_JINENG_1)) {
				control = skill.getSkillGrid();
			} else if (element.equals(SKILL_SHEZHI)) {
				control = skill.getSkillButton();
			} else if (element.equals(SKILL_JINENG_2)) {
				control = skill.getEquipGrid();
			} else if (element.equals(SKILL_JINENGSHENGJI_1)) {
				control = skill.getShowLearnButton();
			} else if (element.equals(SKILL_SHENGJI)) {
				control = skill.getlearnButton();
			} else if (element.equals(SKILL_SHUT)) {
				control = skill.getCloseImg();
			} 
			else {
				Tools.debugPrintln("错误 : 用户引导技能界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	//////////////////////////////////////////////////////
	//	社交界面
	//////////////////////////////////////////////////////
	/** 好友界面 */
	public static final String SOCIAL_FRIEND = "friend";
	/** 婚姻界面 */
	public static final String SOCIAL_MARRIAGE = "marriage";
	/** 敌人界面 */
	public static final String SOCIAL_ENEMY = "enemy";
	/** 黑名单界面 */
	public static final String SOCILA_BLACKLIST = "blacklist";
	/** 我的队伍界面 */
	public static final String SOCILA_MYTEAM = "myteam";
	/** 其他队伍界面 */
	public static final String SOCILA_OTHERTEAM = "otherteam";
	/** 师徒界面 */
	public static final String SOCILA_MASTERSTUDENT = "masterstudent";
	/** 关闭 */
	public static final String SOCILA_SHUT = "shut";
	/** 推送好友 */
	public static final String SOCILA_FRIDND = "tuijianhaoyou";
	/** 推荐师傅 */
	public static final String SOCILA_MASTERSTUDE = "tuijianshifu";
	
	public DWControl checkSocial(String element) {
		UISocial social = UIWindows.getInstance().m_social;
		if (social != null) {
			DWControl control = null;
			if (element.equals(SOCILA_FRIDND)) {/** 推送好友*/
				
				control = social.button_open_haoyou();
				
			}else if (element.equals(SOCILA_MASTERSTUDE)) {/** 师徒 */
				
				control = social.button_open_shifu();
				
			}else if (element.equals(SOCIAL_FRIEND)) {
				DWTabControl tc = social.getTabCt();
				if (tc != null) {
					tc.setGuidePageIndex(0);
					control = tc;
				}
			} else if (element.equals(SOCIAL_MARRIAGE)) {
				DWTabControl tc = social.getTabCt();
				if(tc != null)
				{
					tc.setGuidePageIndex(1);
					control = tc;
				}
			} else if (element.equals(SOCIAL_ENEMY)) {
				DWTabControl tc = social.getTabCt();
				if(tc != null)
				{
					tc.setGuidePageIndex(2);
					control = tc;
				}
			} else if (element.equals(SOCILA_BLACKLIST)) {
				DWTabControl tc = social.getTabCt();
				if(tc != null)
				{
					tc.setGuidePageIndex(3);
					control = tc;
				}
			} else if (element.equals(SOCILA_MYTEAM)) {
				DWTabControl tc = social.getTabCt();
				if(tc != null)
				{
					tc.setGuidePageIndex(4);
					control = tc;
				}
			} else if (element.equals(SOCILA_OTHERTEAM)) {
				DWTabControl tc = social.getTabCt();
				if(tc != null)
				{
					tc.setGuidePageIndex(5);
					control = tc;
				}
			} else if (element.equals(SOCILA_MASTERSTUDENT)) {
				DWTabControl tc = social.getTabCt();
				if(tc != null)
				{
					tc.setGuidePageIndex(6);
					control = tc;
				}
			} else if (element.equals(SOCILA_SHUT)) {
				control = social.getClose();
			} else {
				Tools.debugPrintln("错误 : 用户引导社交界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	//////////////////////////////////////////////////////
	//	炼魂界面
	//////////////////////////////////////////////////////
	/** 力魂页 */
	public static final String SOUL_ATTACK = "attack";//1
	/** 地魂页 */
	public static final String SOUL_MAGDEF = "magdef";//3
	/** 天魂页 */
	public static final String SOUL_PHYDEF = "phydef";//2
	/** 灵魂页 */
	public static final String SOUL_HIT = "hit";//4
	/** 精魂页 */
	public static final String SOUL_MISS = "miss";//5
	/** 气魂页 */
	public static final String SOUL_MAXHP = "maxhp";//0
	
	/** 力魂页魂位 */
	public static final String SOUL_ATTACKSOUL = "attacksoul_";//1
	/** 地魂页魂位 */
	public static final String SOUL_MAGDEFSOUL = "magdefsoul_";//3
	/** 天魂页魂位 */
	public static final String SOUL_PHYDEFSOUL = "phydefsoul_";//2
	/** 灵魂页魂位 */
	public static final String SOUL_HITSOUL = "hitsoul_";//4
	/** 精魂页魂位 */
	public static final String SOUL_MISSSOUL = "misssoul_";//5
	/** 气魂页魂位 */
	public static final String SOUL_MAXHPSOUL = "maxhpsoul_";//0
	
	/** 关闭 */
	public static final String SOUL_SHUT = "shut";
	
	public DWControl checkSoul(String element) {
		UISoulWindow soul = UIWindows.getInstance().m_soul;
		if (soul != null) {
			DWControl control = null;
			if (element.equals(SOUL_ATTACK)) {
				DWTabControl tc = soul.getTabControl();
				if (tc != null) {
					tc.setGuidePageIndex(1);
					control = tc;
				}
			} else if (element.equals(SOUL_MAGDEF)) {
				DWTabControl tc = soul.getTabControl();
				if (tc != null) {
					tc.setGuidePageIndex(3);
					control = tc;
				}
			} else if (element.equals(SOUL_PHYDEF)) {
				DWTabControl tc = soul.getTabControl();
				if (tc != null) {
					tc.setGuidePageIndex(2);
					control = tc;
				}
			} else if (element.equals(SOUL_HIT)) {
				DWTabControl tc = soul.getTabControl();
				if (tc != null) {
					tc.setGuidePageIndex(4);
					control = tc;
				}
			} else if (element.equals(SOUL_MISS)) {
				DWTabControl tc = soul.getTabControl();
				if (tc != null) {
					tc.setGuidePageIndex(5);
					control = tc;
				}
			} else if (element.equals(SOUL_MAXHP)) {
				DWTabControl tc = soul.getTabControl();
				if (tc != null) {
					tc.setGuidePageIndex(0);
					control = tc;
				}
			} else if (element.indexOf(SOUL_ATTACKSOUL) != -1) {
				int index = Integer.parseInt(element.substring(element.indexOf("l_") + 2));
				control = soul.getSoul(1, index);
			} else if (element.indexOf(SOUL_MAGDEFSOUL) != -1) {
				int index = Integer.parseInt(element.substring(element.indexOf("l_") + 2));
				control = soul.getSoul(3, index);
			} else if (element.indexOf(SOUL_PHYDEFSOUL) != -1) {
				int index = Integer.parseInt(element.substring(element.indexOf("l_") + 2));
				control = soul.getSoul(2, index);
			} else if (element.indexOf(SOUL_HITSOUL) != -1) {
				int index = Integer.parseInt(element.substring(element.indexOf("l_") + 2));
				control = soul.getSoul(4, index);
			} else if (element.indexOf(SOUL_MISSSOUL) != -1) {
				int index = Integer.parseInt(element.substring(element.indexOf("l_") + 2));
				control = soul.getSoul(5, index);
			} else if (element.indexOf(SOUL_MAXHPSOUL) != -1) {
				int index = Integer.parseInt(element.substring(element.indexOf("l_") + 2));
				control = soul.getSoul(0, index);
			} else if (element.equals(SOUL_SHUT)) {
				control = soul.getShut();
			} else {
				Tools.debugPrintln("错误 : 用户引导炼魂界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	}
	
	//////////////////////////////////////////////////////
	//	领奖界面
	//////////////////////////////////////////////////////
	/** 领奖按钮 */
	public static final String AWARD_LINGJIANG = "lingjiang";
	/** 关闭 */
	public static final String AWARD_SHUT = "shut";
	
	public DWControl checkAward(String element) {

		UIPrizeWindow prize = UIWindows.getInstance().m_prize;
		if (prize != null) {
			DWControl control = null;
			if (element.equals(AWARD_LINGJIANG)) {
				control = prize.BackButton();
			} else if (element.equals(AWARD_SHUT)) {
				control = prize.BackImage();
			} else {
				Tools.debugPrintln("错误 : 用户引导领奖界面没有找到元素 : " + element);
			}
			if (control != null) {
				control.setGuide(true);
				return control;
			}
		}
		m_waiting = true;
		return null;
	
	}
	
	
	
}
